<!DOCTYPE html>
<html lang="en" ng-app>

<head>
    <meta charset="UTF-8">
    <title>考试</title>
    <link href="./css/bootstrap.min.css" rel="stylesheet">
    <link href="./css/font-awesome.css" rel="stylesheet">
    <link href="./css/main.css" rel="stylesheet">
    <script src="./js/jquery.min.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="./js/jquery.pin.js"></script>
	<script src="js/angular.min.js"></script>

    <style type="text/css">
        /* Custom Styles */
        ul.nav-tabs {
            width: 140px;
            margin-top: 50px;
            border-radius: 4px;
            border: 1px solid #ddd;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.067);
        }
        ul.nav-tabs li {
            margin: 0;
            border-top: 1px solid #ddd;
        }
        ul.nav-tabs li:first-child {
            border-top: none;
        }
        ul.nav-tabs li a {
            margin: 0;
            padding: 8px 16px;
            border-radius: 0;
        }
        ul.nav-tabs li.active a,
        ul.nav-tabs li.active a:hover {
            color: #fff;
            background: #0088cc;
            border: 1px solid #0088cc;
        }
        ul.nav-tabs li:first-child a {
            border-radius: 4px 4px 0 0;
        }
        ul.nav-tabs li:last-child a {
            border-radius: 0 0 4px 4px;
        }
        ul.nav-tabs.affix {
            top: 10px;
            /* Set the top position of pinned element */
        }
    </style>
</head>

<body data-spy="scroll" data-target="#myScrollspy" ng-controller="exam">
     <!--导航栏-->
    <div class="navbar navbar-njust navbar-fixed" role="navigation">
        <div class="container clearfix">
            <div class="navbar-header">

                <div class="navbar-brand">
                    <i class="fa fa-cubes"></i>
                    <h4 id="maintitle">课程考试系统</h4>
                </div>
            </div>

            <div class="navbar-collapse collapse">

                <ul class="nav navbar-nav" style="margin-left:400px">
                    <li class="pull-left">
                        <a href="home.html">首页</a>
                    </li>

                    <li class="pull-left active">
                        <a href="#">课程考试</a>
                    </li>
					
                </ul>
                <div class="list-unstyled pull-right clearfix dropdown" style="margin-top:25px">
                    <li class="dropdown-toggle " id="dropdownMenu1" data-toggle="dropdown">
                        <a href="" style="width:200px">欢迎您，<span id="username">{{student.name}}</span>学生</a>
                    </li>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                        <li role="presentation"><a role="menuitem" tabindex="-1" href="studentEditInfo.html">我的账户</a>
                        </li>
                        <li role="presentation"><a  id = "logoutBtn" role="menuitem" tabindex="-1" href="student!logout.action">注销</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>


    <div class="container">
        <div class="row">
            <div class="col-md-2">
                <div class="row">
                    <div class="col-md-12">
                        <div id="myScrollspy" class="pinned">
                            <ul class="nav nav-tabs nav-stacked" id="myNav">
                                <li class="active">
                                    <a href="#xuanze">选择题</a>
                                </li>
                                <li>
                                    <a href="#tiankong">填空题</a>
                                </li>
                                <li>
                                    <a href="#jianda">简答题</a>
                                </li>
                            </ul>
                            <br/>
                            <h4>当前时间：</h4>
                            <div id="currentTime" style="float: right; font-size: 16px; "></div>
							
                        </div>
                    </div>
                    <br/>
                    <br/>


                </div>

            </div>



            <div class="col-md-10">
               <div class="row" style="font-size:18px">  <!--考试基本信息-->
                  <div class="col-md-3">
                     课程名称：{{course.courseName}}
                      
                  </div>
                  <div class="col-md-3">
                     考试名称：{{exam.examName}}
                      
                  </div>
                  <div class="col-md-3">
                     组卷老师：{{teacher.name}}
                      
                  </div>
                  <div class="col-md-3">
                     结束时间：{{exam.endTime}}
                      
                  </div>
                   
               </div>
			   
                <div class="row"> <!-- main -->
                    <h3 id="xuanze">选择题</h3>
                    <div class="row" ng-repeat="multiple in multiples">
                        <div class="col-md-10">
                            <pre>{{multiple.questionStem}}</pre>
                        </div>
                        <div class="col-md-2">
                            <div class="dropdown">
                                <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
                                    未选择
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                                    <li role="presentation"><a role="menuitem" tabindex="-1" href="#" class="item"
										ng-click="multiple.answer = 'A'">A</a>
                                    </li>
                                    <li role="presentation"><a role="menuitem" tabindex="-1" href="#" class="item"
										ng-click="multiple.answer = 'B'">B</a>
                                    </li>
                                    <li role="presentation"><a role="menuitem" tabindex="-1" href="#" class="item"
										ng-click="multiple.answer = 'C'">C</a>
                                    </li>
                                    <li role="presentation"><a role="menuitem" tabindex="-1" href="#" class="item"
										ng-click="multiple.answer = 'D'">D</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                   
                    <h3 id="tiankong">填空题</h3>
                    <div class="row" ng-repeat="shortAnswer in shortAnswers">
                        <div class="col-md-10">
                            <pre>{{shortAnswer.questionStem}}</pre>
                        </div>
                        <div class="col-md-2">
                            <input type="text" class="form-control" placeholder="未输入答案" 
								ng-model="shortAnswer.answer">
                        </div>
                    </div>
      
                    <h3 id="jianda">简答题</h3>
                    <div class="row" ng-repeat="longAnswer in longAnswers">
                        <div class="col-md-10">
                            <pre>{{longAnswer.questionStem}}</pre>
                        </div>
                        <div class="col-md-10">
                            <textarea rows="6" cols="112" style="resize: none;" placeholder="未输入答案"
								ng-model="longAnswer.answer"></textarea>
                        </div>
                    </div>
               
                    <div class="col-md-10">
                        <button type="button" class="btn btn-primary btn-lg btn-block" ng-click="submitAnswer()">
							确认提交
						</button>
                    </div>
                </div>
            
			</div>


        </div>

    </div>
    
	<!--页脚-->
    <footer class="footer clearfix">
        <div class="container">
            <ul class="list-unstyled list-inline pull-left">
                <li>
                    <a href="#">FAQ</a>
                </li>
                <li>
                    <a href="#">Git</a>
                </li>
                <li>
                    <a href="#">Blog</a>
                </li>
            </ul>
            <p class="pull-right">@ 2014 软件项目管理团队</p>

        </div>
    </footer>

    <script>
        $(".pinned").pin({
            containerSelector: ".container"
        });
    </script>

    <script>
        $(document).ready(function () {
            $(".item").click(function () {
                $(this).parent().parent().siblings("button").text($(this).text());
            });

        });
    </script>

    <script type="text/javascript">
        function showLocale(objD) {
            var str, colorhead, colorfoot;
            var yy = objD.getYear();
            if (yy < 1900) yy = yy + 1900;
            var MM = objD.getMonth() + 1;
            if (MM < 10) MM = '0' + MM;
            var dd = objD.getDate();
            if (dd < 10) dd = '0' + dd;
            var hh = objD.getHours();
            if (hh < 10) hh = '0' + hh;
            var mm = objD.getMinutes();
            if (mm < 10) mm = '0' + mm;
            var ss = objD.getSeconds();
            if (ss < 10) ss = '0' + ss;
            var ww = objD.getDay();
            if (ww == 0) colorhead = "<font color=\"#FF0000\">";
            if (ww > 0 && ww < 6) colorhead = "<font color=\"#373737\">";
            if (ww == 6) colorhead = "<font color=\"#008000\">";
            if (ww == 0) ww = "星期日";
            if (ww == 1) ww = "星期一";
            if (ww == 2) ww = "星期二";
            if (ww == 3) ww = "星期三";
            if (ww == 4) ww = "星期四";
            if (ww == 5) ww = "星期五";
            if (ww == 6) ww = "星期六";
            colorfoot = "</font>"
            str = colorhead + yy + "年" + MM + "月" + dd + "日" + hh + ":" + mm + ":" + ss + " " + ww + colorfoot;
            return (str);
        }

        function tick() {
            var today;
            today = new Date();
            document.getElementById("currentTime").innerHTML = showLocale(today);
            window.setTimeout("tick()", 1000);
        }
        tick();
    </script>
	
	<script> <!-- angular -->
		
		function exam($scope,$http){
			//init
			var student = new Object() , course = new Object() ,
				teacher = new Object() , exam = new Object();
			var multiples = new Array();
			var shortAnswers = new Array();
			var longAnswers = new Array();
			
			$scope.student = student; $scope.teacher = teacher;
			$scope.course = course; $scope.exam = exam;
			$scope.multiples = multiples;  
			$scope.shortAnswers = shortAnswers;   
			$scope.longAnswers = longAnswers; 
			
			//init
			student.name = "foolifish07";
			exam.examName = '欢乐考试'; exam.courseNo = 0; exam.endTime = "12-12-17 12:00";
			course.courseName = '软件项目管理'; teacher.name = 'hdd';
			
			for(var i = 0;i<2;i++){
				multiples[i] = new Object();
				multiples[i].questionStem = (1+i)+'.一个C程序的执行是从_____。         \nA)本程序的main函数开始,到main函数结束               B)本程序文件的第一个函数开始,到本程序文件的最后一个函数结束 \nC)本程序的main函数开始,到本程序文件的最后一个函数结束  D)本程序文件的第一个函数开始,到本程序main函数结束';
				multiples[i].difficulty = 3;
				multiples[i].value = 2;
				
				multiples[i].knowledge  = new Array();
				multiples[i].knowledge[0] = '并查集';
				multiples[i].knowledge[1] = '垃圾暴力';
				
				multiples[i].answer = '';
			}
			for(var i = 0;i<3;i++){
				shortAnswers[i] = new Object();
				shortAnswers[i].questionStem = (i+1)+'.若x和n均是int型变量,且x和n的初值均为5,则计算表达式 x+=n++ 后x的值为 ____,n的值为6.';
				shortAnswers[i].difficulty = 3;
				shortAnswers[i].value = 2;
				
				shortAnswers[i].knowledge  = new Array();
				shortAnswers[i].knowledge[0] = '并查集';
				shortAnswers[i].knowledge[1] = '垃圾暴力';
				
				shortAnswers[i].answer = '';
			}
			for(var i = 0;i<4;i++){
				longAnswers[i] = new Object();
				//init[i].describe = "asdfdsa";
				longAnswers[i].questionStem = (i+1)+'.关键字和一般标识符有什么不同？';
				longAnswers[i].difficulty = 3;
				longAnswers[i].value = 2;
				
				longAnswers[i].knowledge  = new Array();
				longAnswers[i].knowledge[0] = '并查集';
				longAnswers[i].knowledge[1] = '你妹夫';
				
				longAnswers[i].answers = '';
			}
			
			//get active data
			$http.get("student!getExam.action").success(function(data){
				//alert("wocao success");
			}).error(function(){
				//alert('wocao fail');
			});
			
			$scope.submitAnswer = function(){
				console.log(multiples);
				alert("成功提交");
				location.href = "student.html";
				//for(var i=0;i<multiples.length;i++) console.log(multiples[i].answer);
				//for(var i=0;i<shortAnswers.length;i++) console.log(shortAnswers[i].answer);
				//for(var i=0;i<longAnswers.length;i++) console.log(longAnswers[i].answer);
			}
		}
		
	</script>

</body>


</html>